<template>
  <div class="recordInfo">
    <div class="btns">
      <div>发送通知详情</div>
      <div>
        <el-button icon="CircleClose" size="large" @click="doClose">关闭</el-button>
      </div>
    </div>
    <div class="content">
      <el-card shadow="never">
        <template #header>
          <el-icon color="#ffffff"><Bell /></el-icon>
          <span class="title">通知信息</span>
        </template>
        <template #default>
          <el-form :model="form" :rules="rules" label-width="85px" size="large" inline>
            <el-form-item label="通知名称:" prop="name">
              {{ form.name }}
            </el-form-item>
            <el-form-item label="发送方式:" prop="sendType">
              {{ form.sendType }}
            </el-form-item>
            <el-form-item label="通知分类:" prop="category">
              {{ form.category }}
            </el-form-item>
            <el-form-item label="标题:" prop="title">
              {{ form.title }}
            </el-form-item>
            <el-form-item label="发送时间:" prop="time">
              {{ form.time }}
            </el-form-item>
            <el-form-item label="内容:" prop="content">
              <el-input v-model="form.content" type="textarea" :rows="4" readonly></el-input>
            </el-form-item>
          </el-form>
        </template>
      </el-card>
      <el-card shadow="never">
        <template #header>
          <el-icon color="#ffffff"><User /></el-icon>
          <span class="title">接收人</span>
        </template>
        <template #default>
          <el-table :data="form.dataList" border>
            <el-table-column label="序号" type="index" align="center" width="60"/>
            <el-table-column label="接收者类型" prop="name" align="center"></el-table-column>
            <el-table-column label="用户名称" prop="desc" align="center"></el-table-column>
            <el-table-column label="编号" prop="desc" align="center"></el-table-column>
          </el-table>
        </template>
      </el-card>
    </div>
  </div>
</template>

<script setup name="recordInfo">
  import { ref, getCurrentInstance } from 'vue'

  // 获取注册的全局实列
  const currentThis = getCurrentInstance().appContext.config.globalProperties

  // 定义父组件传入的值
  const props = defineProps({
    noticeId: {
      type: String,
      default: '',
      required: true
    }
  })
  const emits = defineEmits(['close'])

  let form = ref({
    name: '撒旦反对',
    sendType: '感到翻跟斗',
    category: '啊适当放大',
    title: '反对士大夫但是',
    time: '2023-05-16 13:25:28',
    content: '您好${name}，欢迎您申请成为众创运通经销商，您的密码是：${password}',
    dataList: [
      {name: 'name', desc: '真实姓名', value:''},
      {name: 'password', desc: '访问密码', value:''},
    ]
  })

  init()
  // 编辑时候初始化数据
  function init() {
    if(!props.noticeId) {
      return
    }
  }

  // 关闭
  function doClose() {
    emits('close')
  }
</script>

<style lang="less" scoped>
.recordInfo{
  padding: 0 80px;
  .btns{
    height: 8vh;
    display: flex;
    justify-content: space-between;
    align-items: center;
    >div{
      width: 50%;
      &:first-child{
        font-size: 25px;
        font-weight: bold;
      }
      &:last-child{
        display: flex;
        justify-content: flex-end;
      }
    }
  }
  .content{
    height: 92vh;
    overflow: hidden auto;
    :deep(.el-card){
      margin-bottom: 15px;
      .el-card__header{
        display: flex;
        align-items: center;
        background: #3BB9F1;
        .el-icon{
          margin-right: 5px;
        }
        .title{
          color: #ffffff;
        }
      }
      .el-card__body{
        .el-form{
          .el-form-item {
            width: 31% ;
            &:last-child{
              width: 48%;
            }
          }
        }
      }
    }
  }
}
</style>